class Solution {
public:
    vector<int> missingRolls(vector<int>& rolls, int mean, int n)
    {
        int sum = 0;
        for (auto& a : rolls) sum += a;
        int sz = rolls.size();
        int sumNum = mean * (n + sz) - sum;//剩下的
        if (sumNum < 0) return {};
        if ((sumNum / n > 6) || (sumNum / n == 0)) return {};
        vector<int> ans(n, sumNum / n);
        sumNum %= n;
        for (int j = 0; j < 6; j++)
            for (int i = 0; i < n && sumNum > 0; i++)
                if (ans[i] < 6) ans[i] ++, sumNum--;
        if (sumNum > 0) return {};

        return ans;
    }
};